const obj = {
    name:"zhangsan",
    age:20,
    info:{
        address:{
            addr:"北京海淀"
        }
    }
}
//劫持方法：
Object.defineProperty(obj,'name',{
    enumerable:true,//可以被循环
    configurable:true, //允许被设置
    get(){
        return 1111
    },
    set(newVal){
        console.log("设置")
    }
})
console.log(1,obj.name) //自动get
obj.name = "lisi" //自动set 
console.log(obj.name) //自动get